<script setup>
import { ref } from 'vue'
import { useRouter } from 'vue-router'
const router = useRouter()
const tansferPath = (toPath) => {
  router.push({
    path: toPath
  })
}
const activeIndex = ref('1')
const handleSelect = (key, keyPath) => {
  console.log(key, keyPath)
  switch (key) {
    case "1":
      tansferPath("/home")
      break
    case "2-1":
      tansferPath("/problem")
      break
    case "2-2":
      tansferPath("/login")
      break
  }
}
</script>

<template>
  <el-menu :default-active="activeIndex" class="el-menu-demo" mode="horizontal" @select="handleSelect">

    <el-menu-item index="1">小杜百科</el-menu-item>
    <el-sub-menu index="2">
      <template #title>其他功能</template>
      <el-menu-item index="2-1">聊天记录</el-menu-item>
      <!-- <el-menu-item index="2-2">注册登录</el-menu-item> -->
    </el-sub-menu>
  </el-menu>
  <router-view></router-view>
</template>

<style scoped></style>
